#include "urltasksview.h"

#include <QTableView>
#include <QHeaderView>

#include "urldelegate.h"

UrlTasksView::UrlTasksView(UrlTasks *model, QWidget *parent) :
    QTableView(parent)
{
    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
    setSelectionMode(QTableView::SingleSelection);
    setSelectionBehavior(QTableView::SelectRows);

    setModel(model);

    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
    horizontalHeader()->setResizeMode(UrlTask::STATUS, QHeaderView::Fixed);
    horizontalHeader()->setStretchLastSection(true);
    verticalHeader()->setResizeMode(QHeaderView::Fixed);

    setItemDelegate(new UrlDelegate(this));

    connect(horizontalHeader(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder))
            , model, SLOT(sort(int,Qt::SortOrder)));
}
